package com.xdap.init.controller;


import com.definesys.mpaas.common.http.Response;
import com.xdap.init.service.TableIndexServiceService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
*@auth lishushu
*@2023/5/15 14:50
*@desc {生成索引}
**/
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/df/table")
@Slf4j
public class TableIndexController {


    @Autowired
    private TableIndexServiceService tableIndexServiceService;
    @PostMapping("/index")
    public Response target() throws Exception {
        Response res = new Response();
        try {
            String result = tableIndexServiceService.init();


            res.setData(result);
        } catch (Exception e) {
            log.error("初始化持久层报错:{}", e);
            res.setCode(Response.CODE_ERR);
            res.setMessage(e.getMessage());
        }
        return res;
    }

}
